<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Dictionary {
            constructor() {
                this.items = {};
            }

            // has
            has(value){
                return value in this.items;
            }

            // set
            set(key,value){
                this.items[key] = value;
            }

            // remove
            remove(key){
                if(this.has(key)){
                    Reflect.deleteProperty(this.items,key);
                }
            }

            // get
            get(key){
                return this.has(key)?this.items[key]:undefined;
            }

            // values
            values(){
                let values = [];
                for (const key in this.items) {
                    if (this.has(key)) {
                        values.push(this.items[key]);
                    }
                }
                return values;
            }

            // clear
            clear() {
                this.items = {};
            }

            // size
            size() {
                return Reflect.ownKeys(this.items).length;
            }

            // keys
            keys() {
                return Reflect.ownKeys(this.items);
            }

            // getItems
            getItems(){
                return items;
            }
        }


        let dict = new Dictionary();
        dict.set('a1','a');
        dict.set('b1','b');
        dict.set('c1','c');
        dict.set('d1','d');
        console.log(dict.values());
        console.log(dict.keys());
        console.log(dict.size());
    </script>
</body>

</html>